#ifndef CROSS_LINK_GRAPH_H
#define CROSS_LINK_GRAPH_H
/* 十字链表法 */
// 边节点
typedef struct arcBox{
	int tailVertex;				// 弧尾编号，表示出度
	struct arcBox *tailNext;	// 从这个指针可以找到下一个弧尾  某个点的出度
	int headVertex;				// 弧头编号，表示入度
	struct arcBox *headNext;
	int weight;
}ArcBox;

// 顶点
typedef struct {
	int no;
	const char *show;
	ArcBox *firstIn;
	ArcBox *firstOut;
}CrossVertex;
// 图头
typedef struct {
	CrossVertex *nodes;
	int numVertex;
	int numEdge;
}CrossGraph;

CrossGraph *createCrossGraph(int n);
void releaseCrossGraph(CrossGraph *graph);
// 初始化图中的顶点信息
void initCrossGraph(CrossGraph *graph, int num, char *names[]);
// 添加边
void addCrossArc(CrossGraph *graph, int tail, int head, int weight);
// 计算某个顶点的入度
int inDegreeCrossGraph(CrossGraph *graph, int no);
// 计算某个顶点的出度
int outDegreeCrossGraph(CrossGraph *graph, int no);
#endif
